package tech.aistar.service.ordershow.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.entity.person_center.Orders;
import tech.aistar.mapper.OrderMapper;
import tech.aistar.service.ordershow.IOrderService;

import java.util.List;

/**
 * Created by Dell on 2019/9/28.
 */
@Service
@Transactional
public class OrderServiceImpl implements IOrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public List<Orders> findAll(Integer user_id, Integer order_status) {
        List<Orders> bookOrders = orderMapper.findAll(user_id,order_status);
        return bookOrders;
    }



/**
 * @Description: 方法分页
 * @param:
 * @author XiaoDi
 * @date 2019/9/28 15:27
*/
    @Override
    public PageInfo<Orders> findAll(Integer user_id, Integer order_status, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);

        List<Orders> bookOrders = orderMapper.findAll(user_id,order_status);

        PageInfo<Orders> pageInfo = new PageInfo<>(bookOrders);
        return pageInfo;
    }
}
